//
//  LKCustomAnnotationView.m
//  LKIntelligentVideoProject
//
//  Created by she1323 on 2018/9/26.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKCustomAnnotationView.h"

@interface LKCustomAnnotationView()

@property(nonatomic,strong)UIImageView *picImagView;
@property(nonatomic,strong)UILabel *contenstLabel;

@end


@implementation LKCustomAnnotationView

-(id)initWithAnnotation:(id<BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
    if (self) {
//        [self setupUI];
    }
    return self;
}

/**
 重新绘制大头针的样式
 */
-(void)setupUI{
    self.contenstLabel = [[UILabel alloc] init];
    self.contenstLabel.textAlignment = NSTextAlignmentCenter;
    self.contenstLabel.backgroundColor = [UIColor whiteColor];
    self.contenstLabel.font = [UIFont systemFontOfSize:15];
    self.contenstLabel.text = self.contens;
    [self addSubview:self.contenstLabel];
    [self.contenstLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.mas_equalTo(20);
    }];
    self.picImagView = [[UIImageView alloc] init];
    self.picImagView.image = self.image;
//    self.picImagView.image = [UIImage imageNamed:@"shexiangtouImage"];
    self.picImagView.userInteractionEnabled = YES;
    [self addSubview:self.picImagView];
    [self.picImagView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.centerX.equalTo(self);
        make.bottom.equalTo(self.contenstLabel.mas_top).offset(-10);
    }];
}

-(void)setContens:(NSString *)contens{
    _contens = contens;
    self.contenstLabel.text = contens;
}

@end
